package com.jack.blog.dto;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Locale;

public abstract class BaseDto {
    @Value("#{config.articleUrl}")
    protected String articleUrl;
    @Value("#{config.coverUrl}")
    protected String coverUrl;
    @Value("#{config.avatarUrl}")
    protected String avatarUrl;
    @Value("#{config.blogCoverAllow}")
    protected List<String> allowBlogCover;
    @Value("#{config.blogAllow}")
    protected List<String> allowBlog;
    @Value("#{config.userAvatarAllow}")
    protected List<String> allowUserAvatar;

    protected String getFileType(String fileName){
        String s = fileName.toLowerCase(Locale.ROOT);
        return s.substring(s.lastIndexOf(".")+1);
    }

}
